package server;

import java.io.File;
import java.rmi.NotBoundException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.List;

import p2p.Peer;

public interface Message extends Remote {
	/**
	 * 
	 * @param fromPeer
	 * @param ttl
	 * @throws RemoteException
	 * @throws NotBoundException
	 */
	void hello(Peer fromPeer, int ttl) throws RemoteException, NotBoundException;
	/**
	 * 
	 * @param fromPeer
	 * @throws RemoteException
	 */
	void ackHello(Peer fromPeer) throws RemoteException, NotBoundException;
	/**
	 * 
	 * @return
	 * @throws RemoteException
	 */
	void isAlive() throws RemoteException;
	/**
	 * 
	 * @param fromPeer
	 * @throws RemoteException
	 * @throws NotBoundException
	 */
	Peer helloNeighbor(Peer fromPeer) throws RemoteException, NotBoundException;
	/**
	 * 
	 * @param fromPeer
	 * @throws RemoteException
	 * @throws NotBoundException
	 */
	boolean isNeighbor(Peer fromPeer) throws RemoteException, NotBoundException;
	/**
	 * 
	 * @return list of peers which are neighbors to node
	 * @throws RemoteException
	 */
	List<Peer> getNeighbors() throws RemoteException;
	/**
	 * 
	 * @param flist
	 * @throws RemoteException
	 */
	boolean reportFileList(Peer fromPeer, List<File> flist) throws RemoteException;
	/**
	 * 
	 * @param fileName
	 * @param TTL
	 * @param K
	 * @throws RemoteException
	 */
	void search(String fileName, int ttl, int k, Peer fromPeer, List<Peer> knownPeers, String trace) throws RemoteException;
	/**
	 * 
	 * @param fileName
	 * @return byte[] of a file with the exact fileName
	 * @throws RemoteException
	 */
	byte[] fileUpload(String fileName) throws RemoteException;
	/**
	 * 
	 * @param message
	 * @throws RemoteException
	 */
	void writeToTerminal(String message) throws RemoteException;
}
